package com.god530.androidutils.utils;

public class LogF {

	/** 重要提示， 关键节点 */
	public static final int L_1 = 1;
	/** 一般提示， 比较重要， 信息量小 */
	public static final int L_2 = 2;
	/** 普通提示， 比较重要， 信息量大 */
	public static final int L_3 = 3;
	/**  */
	public static final int L_4 = 4; //
	/** 一般的过程信息， 显示流程, 基本上不显示重要信息(返回的信息等) */
	public static final int L_5 = 5;
	/** 大量的提示， 显示全部信息, 最后排除的时候可以省略 */
	public static final int L_6 = 6;

	private LogF() {
		/* cannot be instantiated. */
		throw new UnsupportedOperationException("cannot be instantiated.");
	}

	private static int currentLevel = L_3;
	public static boolean isDebug = true;
	private static final String TAG = "sainthigh";

	private static boolean getLevelDisplay(int level) {
		if (isDebug && (level >= currentLevel)) {
			return true;
		}
		return false;
	}

	public static void i(int level, Object... objects) {
		if (getLevelDisplay(level)) {
			android.util.Log.i(TAG, toString(objects));
		}
	}

	public static void i(int level, String TAG, Object... objects) {
		if (getLevelDisplay(level)) {
			android.util.Log.i(TAG, toString(objects));
		}
	}

	public static void d(int level, Object... objects) {
		if (getLevelDisplay(level)) {
			android.util.Log.d(TAG, toString(objects));
		}
	}

	public static void d(int level, String TAG, Object... objects) {
		if (getLevelDisplay(level)) {
			android.util.Log.d(TAG, toString(objects));
		}
	}

	public static void w(int level, Object... objects) {
		if (getLevelDisplay(level)) {
			android.util.Log.w(TAG, toString(objects));
		}
	}

	public static void w(int level, String TAG, Object... objects) {
		if (getLevelDisplay(level)) {
			android.util.Log.w(TAG, toString(objects));
		}
	}

	public static void e(int level, Object... objects) {
		if (getLevelDisplay(level)) {
			android.util.Log.e(TAG, toString(objects));
		}
	}

	public static void e(int level, String TAG, Object... objects) {
		if (getLevelDisplay(level)) {
			android.util.Log.e(TAG, toString(objects));
		}
	}

	private static String toString(Object... objects) {
		StringBuilder sb = new StringBuilder();
		for (Object o : objects) {
			sb.append(o);
		}
		return sb.toString();
	}

}
